3D Graphics Programming with QuickDraw 3D 1.5.4
Previous | QD3D Book | Overview | Chapter Contents | Next |
Uns32 nObjects
PackingEnum packing
Uns32 nIndices
Uns32 indices[nIndices]
A face attribute set list is used to assign sets of attributes separately and selectively to one or more facets of a multi-faceted geometric object (that is, to the faces of a box or mesh, or to the triangular facets of a trigrid). A face attribute set list may not be assigned to a general polygon. The listed attribute sets themselves occur as child objects of the set list object and are correlated with facets of the parent object of the set list as described later in this section. You may think of the child objects as the items in the set list; officially, the set list is the object defined in this section.
For convenience, the packing field allows you to choose whether to specify (by inclusion) the facets to receive attributes or to specify (by exclusion) the facets not to receive attributes. The number of child objects you must specify is equal to the number of facets actually to receive attributes, whichever option you select for the packing field. You may wish to specify by inclusion rather than by exclusion if most facets are not to receive any attributes. This option can reduce the size of the indices[] array, save work, and save disk space.
If the value of the packing field of a set list is include , then the number of child objects of that set list must equal the value of the nIndices field of that set list. If the value of the packing field is exclude , then the number of child objects must equal the (absolute value of) the difference between the values of the nObjects and nIndices fields.
Child objects are correlated with facets of the parent object of the set list as follows. Let the child objects of the set list be enumerated in the order of their occurrence in the metafile. If the value of the packing field is include , then the ith child object is correlated with the facet whose index is the value of the ith field of the array indices[] , or indices[i-1] . If the value of the packing field is exclude , then the ith child object is correlated with the facet whose facet index is the i th element of the sequence (in increasing order) of facets whose indices do not appear in the array indices[] . For example, suppose that the parent object is a mesh having 17 faces, packing is set to exclude , nIndices is 11, and the elements of indices[] are 1, 2, 4, 6, 7, 8, 11, 12, 13, 14, 16. Then six facets are to receive attributes: facets 0, 3, 5, 9, 10, 15, so the set list will have six child objects c0,..., c5. The third child object (that is, c2) is correlated with facet 5, and, in general, the ith element of the sequence <c0,..., c5> is correlated with the ith element of the sequence <0, 3, 5, 9, 10, 15>.
The index used to enumerate the facets of a multifaceted geometric object is described in the section pertaining to that object. Indices begin with zero, so that the index of the i +1st facet of a multifaceted object is i . The index used to construct an attribute set list must be standard.
Attribute sets (required). The number of child objects is determined in the manner indicated in the description of a face attribute set list.
Container (
TriGrid (...) #parent object
Container (
FaceAttributeSetList ( )
6 #nObjects (parent has six facets;
exclude #packing (exclude
4 #nIndices (four of them:
0 2 3 5 #indices[] (these four.)
#begin list
Container (
AttributeSet #apply to facet 1
DiffuseColor (...)
)
Container (
AttributeSet #apply to facet 4
DiffuseColor (...)
#end list
)
)
)
Previous | QD3D Book | Overview | Chapter Contents | Next |